<?php
namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class AppStandard extends Model
{
    protected $table = 'app_standard';
    const CHANNEL = [
        '100' => '约遇',
        '200' => '缘友',
        '300' => '聊友',
        '400' => '同城交友'
    ];

    const TYPE = [
        '0' => '用户协议',
        '1' => '隐私政策',
        '2'=>'平台公约'
    ];

    public static function getChannel($appid=100)
    {
        return self::CHANNEL[$appid] ?? '';
    }

    public static function getType($type = 0)
    {
        return self::TYPE[$type] ?? '';
    }

    public function setCheckChannelAttribute($channel)
    {
        $this->attributes['check_channel'] = implode(',', $channel);
    }
}
